package com.mybdqn.service;

import com.mybdqn.pojo.Permission;
import com.mybdqn.dao.PermissionMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
* Service Class Permission
*
* 2017-12-14
*/

@Service
@Transactional
public class PermissionServiceImpl implements PermissionService {

    @Resource
    private PermissionMapper permissionMapper;

    @Transactional(readOnly = true)
    public Permission getPermissionById(Integer id)throws Exception{
        return permissionMapper.getPermissionById(id);
    }

    @Transactional(readOnly = true)
    public List<Permission> getPermissionListByMap(Map<String,Object> param)throws Exception {
        return permissionMapper.getPermissionListByMap(param);
    }
    
    @Transactional(readOnly = true)
    public Integer getPermissionRecCountByMap(Map<String,Object> param)throws Exception {
    	return permissionMapper.getPermissionRecordCount(param);
    }
    

    public Integer insertPermission(Permission permission)throws Exception {
        return permissionMapper.insertPermission(permission);
    }

    public Integer updatePermission(Permission permission)throws Exception {
        return permissionMapper.updatePermission(permission);
    }

    public Integer deletePermissionById(Integer id)throws Exception {
        return permissionMapper.deletePermissionById(id);
    }

    public Set<String> getPermissionByRoleNames(Set<String> roleNames) {
        return permissionMapper.getPermissionByRoleNames(roleNames);
    }

}